﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Carto;

namespace Bes.Swsp.ToolBox
{
  public class EnumLayer : List<ILayer>, IEnumLayer
  {
    int _currentIndex = -1;


    #region IEnumLayer Members
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    public ILayer Next()
    {
      if (_currentIndex < this.Count - 1)
      {
        return this[++_currentIndex];
      }
      else
      {
        // ArcObjects expects error, not null at end of enumeration.
        throw new System.Runtime.InteropServices.COMException("Index out of range.");
      }
    }

    public void Reset()
    {
      _currentIndex = -1;
    }

    #endregion
  }
}
